﻿namespace HZY.Framework.Repository.EntityFramework.Models.Standard;

/// <summary>
/// 创建和更新
/// </summary>
/// <typeparam name="TKey"></typeparam>
public class CreateAndUpdateEntity<TKey> : Entity<TKey>, ICreateAndUpdateEntity
{
    /// <summary>
    /// 创建人 id
    /// </summary>
    [TableField(TableFieldFill.CreateId)]
    public virtual Guid? CreatorUserId { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [TableField(TableFieldFill.CreateTime)]
    public virtual DateTime CreationTime { get; set; } = DateTime.MinValue;

    /// <summary>
    /// 最后更新人
    /// </summary>
    [TableField(TableFieldFill.UpdateId)]
    public virtual Guid? LastModifierUserId { get; set; }

    /// <summary>
    /// 最后更新时间
    /// </summary>
    [TableField(TableFieldFill.UpdateTime)]
    public virtual DateTime? LastModificationTime { get; set; }
}

/// <summary>
/// 创建
/// </summary>
public interface ICreateAndUpdateEntity : IEntity
{
    /// <summary>
    /// 创建用户
    /// </summary>
    [TableField(TableFieldFill.CreateId)]
    Guid? CreatorUserId { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [TableField(TableFieldFill.CreateTime)]
    DateTime CreationTime { get; set; }

    /// <summary>
    /// 更新用户
    /// </summary>
    [TableField(TableFieldFill.UpdateId)]
    Guid? LastModifierUserId { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [TableField(TableFieldFill.UpdateTime)]
    DateTime? LastModificationTime { get; set; }
}